import { notification } from 'antd';
import { getRecruitEfficiency } from '@/services/recruitStat/talentPool';

export default {
    namespace: 'talentPool1',
    state: {
        data: []
    },
    effects: {
        *getTalentPool({ payload }, { put, call }) {
            const result = yield call(getRecruitEfficiency, payload);
            if (result && result.code === 10000) {
                yield put({
                    type: 'save',
                    payload: {
                        data: result.data
                    }
                });
            } else {
                notification.error({
                    message: `请求错误 ${result.msg}`
                });
            }
        }
    },
    reducers: {
        save(state, { payload }) {
            return {
                ...state,
                ...payload
            };
        },
        clear(state) {
            return {
                ...state,
                data: []
            };
        }
    }
};
